package com.itaming.lycheeframework.mybatisplus.config;

import com.baomidou.mybatisplus.autoconfigure.IdentifierGeneratorAutoConfiguration;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.itaming.lycheeframework.mybatisplus.id.LycheeIdGenerator;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;

/**
 * 自定义ID生成器配置类
 *
 * @author A.Ming
 */
@AutoConfiguration(before = IdentifierGeneratorAutoConfiguration.class)
public class LycheeIdGeneratorConfiguration {

    /**
     * 自定义ID生成器
     */
    @Bean
    @ConditionalOnMissingBean
    public IdentifierGenerator identifierGenerator() {
        return new LycheeIdGenerator();
    }

}
